package com.gxa.controller.flow;

import com.gxa.common.R;
import com.gxa.entity.*;
import com.gxa.service.ClosePatientService;
import io.swagger.annotations.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;


@Controller
/**
 * @Auther: Luo
 * @Date: 2023/2/18 - 02 - 18 - 9:15
 * @Description: com.gxa.controller.flow
 * @version: 1.0
 */
@RequestMapping(value = "/cryptographer")
@Api(value = "密接数据test",tags = "密接数据接口API")
public class ClosePatientController {
    @Autowired
    private ClosePatientService closePatientService;

    /**
     * 1分页查询所有的密集人员接口
     * @param currentPage
     * @param pageSize
     */
    @RequestMapping(value = "/findClosePatientList",method = RequestMethod.GET)
    @ApiOperation(value = "查询所有的密集人员接口",notes = "查询所有密集人员",httpMethod = "GET", response = R.class)
    @ApiImplicitParams({@ApiImplicitParam(name = "currentPage",value = "当前页",required = true,dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageSize",value = "页面大小",required = true,dataType = "int",paramType = "query")})
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R findClosePatientList(Integer currentPage,Integer pageSize){

        return closePatientService.findClosePatientList(currentPage,pageSize);
    }


    /**
     * 按条件查询密接人员列表
     * @param currentPage
     * @param pageSize
     * @param name
     * @param sex
     * @param idNum
     * @param phoneNum
     * @param address
     * @param registrant
     * @param registrationDate
     * @param jointType
     * @param status
     * @return
     */
    @RequestMapping(value = "/findClosePatientListByConditions",method = RequestMethod.GET)
    @ApiOperation(value = "条件查询密集人员接口",notes = "根据身份证号查询密集人员",httpMethod = "GET", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查询成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R findClosePatientListByConditions(Integer currentPage, Integer pageSize, String name, String sex, String idNum, String phoneNum, String address, String registrant, Date registrationDate,String jointType,String status){


        return closePatientService.findClosePatientListByConditions(currentPage,pageSize,name,sex,idNum,phoneNum,address,registrant,registrationDate,jointType,status);
    }


    /**
     * 3根据ID查询密接人员
     * @param id
     * @return
     */
    @RequestMapping(value = "/findClosePatientListById",method = RequestMethod.GET)
    @ResponseBody
    public R findClosePatientById(Integer id) {
            return closePatientService.findClosePatientById(id);
    }


    /**
     * 4新增密接人员接口
     * @param districtSysContact
     * @return
     */
    @RequestMapping(value = "/addClosePatient",method = RequestMethod.POST)
    @ApiOperation(value = "新增密接人员接口",notes = "增加密接人员",httpMethod = "POST", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R addClosePatient(@RequestBody DistrictSysContact districtSysContact,@RequestParam(value = "operator") String operator){

        return closePatientService.addClosePatient(districtSysContact,"密接",operator);
    }


    /**
     * 5增加次密接人员接口
     * @param districtSysContact
     * @return
     */
    @RequestMapping(value = "/addIsNextCrowded",method = RequestMethod.POST)
    @ApiOperation(value = "增加次密接人员接口",notes = "增加次密接人员",httpMethod = "POST", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R addIsNextCrowded(@RequestBody @ApiParam(name = "districtSysContact",value = "密接/次密/一般人员信息",required = true) DistrictSysContact districtSysContact,@RequestParam(value = "operator") String operator){


        return closePatientService.addClosePatient(districtSysContact,"次密接",operator);
    }

    /**
     * 6新增如果是一般接触人员接口
     * @param districtSysContact
     * @return
     */
    @RequestMapping(value = "/addIsGeneralCrowded",method = RequestMethod.POST)
    @ApiOperation(value = "新增如果是一般接触人员接口",notes = "增加一般接触人员",httpMethod = "POST", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="添加成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R addIsGeneralCrowded(@RequestBody @ApiParam(name = "districtSysContact",value = "密接/次密/一般人员信息",required = true) DistrictSysContact districtSysContact,@RequestParam(value = "operator") String operator){

        return closePatientService.addClosePatient(districtSysContact,"一般接触",operator);
    }

    /**
     * 7编辑密接人员信息
     * @param districtSysContact
     * @param operator
     * @return
     */
    @RequestMapping(value = "/updateClosePatient",method = RequestMethod.POST)
    @ResponseBody
    public R updateClosePatient(@RequestBody DistrictSysContact districtSysContact,@RequestParam(value = "operator") String operator ){
        return closePatientService.updateClosePatient(districtSysContact,operator);
    }
//    /**
//     * 疫苗接种记录接口
//     * @param patientVaccination
//     * @return
//     */
//    @RequestMapping(value = "/addVaccineNotes",method = RequestMethod.POST)
//    @ApiOperation(value = "疫苗接种记录接口",notes = "次密接的病人的疫苗接种记录",httpMethod = "POST", response = R.class)
//    @ApiResponses({
//            @ApiResponse(code=200,message="添加成功"),
//            @ApiResponse(code=404,message="找不到页面"),
//            @ApiResponse(code=500,message="后台服务错误")
//    })
//    @ResponseBody
//    public R addVaccineNotes(@RequestBody @ApiParam(name = "patientVaccination",value = "疫苗接种记录",required = true) PatientVaccination patientVaccination){
//
//        R r = new R();
//        r.setCode(200);
//        r.setMsg("添加成功");
//        return r;
//    }

    /**
     * 8删除密接人员的接口
     * @param id
     * @return
     */
    @RequestMapping(value = "/delCrowded",method = RequestMethod.GET)
    @ApiOperation(value = "删除密接人员的接口",notes = "删除密接人员",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "id",value = "密接人员编号",required = true,dataType = "int")
    @ApiResponses({
            @ApiResponse(code=200,message="删除成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R delCrowded(Integer id){


        return closePatientService.delCrowded(id);
    }

    /***
     * 9查看基本信息接口
     * @param id
     * @return
     */
    @RequestMapping(value = "/selectBasicInfo",method = RequestMethod.GET)
    @ApiOperation(value = "查看基本信息接口",notes = "查看基本信息",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "id",value = "密接人员编号",required = true,dataType = "int",paramType = "query")
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectBasicInfo(Integer id){

        return closePatientService.selectBasicInfo(id);
    }



    /**
     * 10查看流行病学轨迹调查接口
     * @param id
     * @return
     */
    @RequestMapping(value = "/finddiseaseSurvey",method = RequestMethod.GET)
    @ApiOperation(value = "流行病学轨迹调查接口",notes = "轨迹调查",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "id",value = "密接人员编号",required = true,dataType = "int",paramType = "query")
    @ResponseBody
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R finddiseaseSurvey(Integer id){

        return closePatientService.finddiseaseSurvey(id);
    }


    /**
     * 11根据ID查询轨迹调查
     * @param id
     * @return
     */
    @RequestMapping(value = "/finddiseaseSurveyById",method = RequestMethod.POST)
    @ResponseBody
    public R finddiseaseSurveyById(Integer id){
        return closePatientService.finddiseaseSurveyById(id);
    }

    /**
     * 12添加轨迹调查
     * @param patientTrack
     * @param patientId
     * @param operator
     * @return
     */
    @RequestMapping(value = "/addDiseaseSurvey",method = RequestMethod.POST)
    @ResponseBody
    public R addDiseaseSurvey(@RequestBody PatientTrack patientTrack,@RequestParam(value = "patientId") Integer patientId,@RequestParam(value = "operator") String operator){

        return closePatientService.addDiseaseSurvey(patientTrack,patientId,operator);
    }

    /**
     * 13修改轨迹调查
     * @param patientTrack
     * @param operator
     * @return
     */
    @RequestMapping(value = "/updateDiseaseSurvey",method = RequestMethod.POST)
    @ResponseBody
    public R updateDiseaseSurvey(@RequestBody PatientTrack patientTrack,@RequestParam(value = "operator")String operator){

        return closePatientService.updateDiseaseSurvey(patientTrack,operator);
    }


    /**
     * 14查询管理次密接人员信息
     * @param currentPage
     * @param pageSize
     * @param id
     * @return
     */
    @RequestMapping(value = "/selectNextCrowded",method = RequestMethod.POST)
    @ApiOperation(value = "关联次密接人员信息接口",notes = "查看关联次密接人员信息",httpMethod = "POST", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R selectNextCrowded(Integer currentPage,Integer pageSize,Integer id){

        return closePatientService.selectNextCrowded(currentPage,pageSize,id);
    }



    @RequestMapping(value = "/selectNextCrowdedByConditions",method = RequestMethod.POST)
    @ApiOperation(value = "关联次密接人员信息接口",notes = "查看关联次密接人员信息",httpMethod = "POST", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R selectNextCrowdedByConditions(Integer currentPage,Integer pageSize,Integer id,String name , String sex ,String idNum, String phoneNum ){

        return closePatientService.selectNextCrowdedByConditions(currentPage,pageSize,id,name,sex,idNum,phoneNum);
    }






    /**
     * 15查看跟踪转运-转运记录接口
     * @param id
     * @return
     */
    @RequestMapping(value = "/selectTrack",method = RequestMethod.POST)
    @ApiOperation(value = "查看跟踪转运接口-转运记录",notes = "跟踪转运",httpMethod = "POST", response = R.class)
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R selectTrack(Integer id){

        return closePatientService.selectTrack(id);
    }

    /**
     * 16查看跟踪转运-隔离接收记录
     * @param id
     * @return
     */
    @RequestMapping(value = "/selectIsolationReceivingRecord",method = RequestMethod.POST)
    @ApiOperation(value = "查看跟踪转运接口-隔离接收记录",notes = "跟踪转运",httpMethod = "POST", response = R.class)
    @ResponseBody
    @ApiImplicitParam(name = "id",value = "密接人员编号",required = true,dataType = "int",paramType = "query")
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectIsolationReceivingRecord(Integer id){

        return closePatientService.selectIsolationReceivingRecord(id);
    }



    /**
     * 17查看跟踪转运-采样检测记录
     * @param id
     * @return
     */
    @RequestMapping(value = "/selectPatientSample",method = RequestMethod.POST)
    @ApiOperation(value = "查看采样检测记录",notes = "跟踪转运",httpMethod = "POST", response = R.class)
    @ResponseBody
    @ApiImplicitParam(name = "id",value = "密接人员编号",required = true,dataType = "int",paramType = "query")
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectPatientSample(int id){

        return closePatientService.selectPatientSample(id);
    }

    /**
     * 18查看跟踪转运-解除隔离记录接口
     * @param id
     * @return
     */
    @RequestMapping(value = "/selectDeisolationRecord",method = RequestMethod.POST)
    @ApiOperation(value = "查看跟踪转运接口-解除隔离记录",notes = "跟踪转运",httpMethod = "POST", response = R.class)
    @ResponseBody
    @ApiImplicitParam(name = "id",value = "密接人员编号",required = true,dataType = "int",paramType = "query")
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectDeisolationRecord(int id){

        return closePatientService.selectDeisolationRecord(id);
    }


    /**
     * 19查看跟踪转运-跟踪转运日志
     * @param id
     * @return
     */
    @RequestMapping(value = "/selectTrackTransshipmentLog",method = RequestMethod.POST)
    @ApiOperation(value = "查看跟踪转运接口-跟踪转运日志",notes = "跟踪转运",httpMethod = "POST", response = R.class)
    @ResponseBody
    @ApiImplicitParam(name = "id",value = "密接人员编号",required = true,dataType = "int",paramType = "query")
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    public R selectTrackTransshipmentLog(int id){

        return closePatientService.selectTrackTransshipmentLog(id);
    }


    /**
     * 20数据日志
     * @param id
     * @return
     */
    @RequestMapping(value = "/dataLog",method = RequestMethod.GET)
    @ApiOperation(value = "数据日志接口",notes = "数据日志",httpMethod = "GET", response = R.class)
    @ApiImplicitParam(name = "id",value = "日志编号",required = true,dataType = "int",paramType = "query")
    @ApiResponses({
            @ApiResponse(code=200,message="查看成功"),
            @ApiResponse(code=404,message="找不到页面"),
            @ApiResponse(code=500,message="后台服务错误")
    })
    @ResponseBody
    public R dataLog(int id){

        return closePatientService.dataLog(id);
    }

}
